<template>
  <span class="setting">
    <div class="setting__shade"
         :class="{'setting__shade--show':isShade}"
         @click="close"></div>
    <i class="el-icon-more" style="color: #fff;"
       @click="open"></i>
    <div class="setting__content" :class="{'setting__content--show':box}">
      <div class="setting__header">版权信息</div>
      <div class="setting__body setting__about">
        <p>Version：{{website.version}}</p>
        <p>Copyright: 技术林.</p>
      </div>
      <!-- <div class="setting__header">设置</div>
      <div class="setting__body setting__about">
        <avue-form v-model="form" :option="option"></avue-form>
      </div> -->
      
      <div class="setting__header">关联产品</div>
      <div class="setting__body setting__about">
        <p><el-link type="primary" href="https://www.kancloud.cn/lijianlin/ethantp51/1196443" target="_blank">基于TP5.1实用案例及教程</el-link></p>
        <p><el-link type="primary" href="https://www.kancloud.cn/lijianlin/jishullin_workflow_engine/1894424" target="_blank">技术林-流程引擎文档</el-link></p>
        <p><el-link type="primary" href="https://www.jishulincs.cn" target="_blank">技术林-社区</el-link></p>
        <!-- <p><el-link type="primary" href="https://www.jishulincs.cn" target="_blank">技术林-在线文档中心</el-link></p> -->
        <p><el-link type="primary" href="http://rages.jishulincs.cn/backend/" target="_blank">技术林-商城(管理端)</el-link></p>
        <span>账号：JzQ32 密码：RtGrcGyZAi</span>
        <p><el-link type="primary" href="http://rages.jishulincs.cn/merchant/" target="_blank">技术林-商城(商户端)</el-link></p>
        <span>账号：test 密码：shanghutest</span>
        <p><el-link type="primary" href="http://h5s.jishulincs.cn" target="_blank">技术林-商城(H5)</el-link></p>
        
        <p><el-link type="primary" href="http://139.155.47.132:8080/RDP-SERVER" target="_blank">技术林-报表设计器(体验)</el-link></p>
        <span>账号：user 密码：000000</span><br/>
        <span>测试可使用数据表：yw_zgjob01,02,03,04</span>
        
        <p><el-link type="primary" href="http://im.jishulincs.cn" target="_blank">技术林-IM即时通讯(纯前端暂未开发后台服务)</el-link></p>
      </div>
    </div>
  </span>
</template>

<script>
import { mapState, mapGetters } from 'vuex'
import { validatenull } from '@/util/validate'
import { option, list } from '@/const/setting/'
export default {
  data () {
    return {
      box: false,
      form: {},
      list: list,
      option: option(this)
    }
  },
  computed: {
    ...mapGetters(['isShade','website']),
    ...mapState({
      showTag: state => state.common.showTag,
      showDebug: state => state.common.showDebug,
      showLock: state => state.common.showLock,
      showColor: state => state.common.showColor,
      showFullScren: state => state.common.showFullScren,
      showCollapse: state => state.common.showCollapse,
      showSearch: state => state.common.showSearch,
      showMenu: state => state.common.showMenu,
      showTheme: state => state.common.showTheme
    })
  },
  created () {
    this.init();
  },
  methods: {
    close () {
      this.box = false;
      this.$store.commit('SET_SHADE', false);
    },
    set (key) {
      const ele = this.find(key);
      this.$store.commit(ele.commit, eval(this.form[ele.key]));
    },
    find (key) {
      return this.list.filter(ele => ele.key === key)[0]
    },
    init () {
      let _this = this
      _this.list.forEach(ele => {
        _this.form[ele.key] = validatenull(_this[ele.key]) ? 'true' : _this[ele.key] + '';
        _this.set(ele.key);
      })
    },
    open () {
      this.box = true;
      this.$store.commit('SET_SHADE', true);
    }
  }
}
</script>

<style lang="scss" scoped>
.setting {
  margin-left: 10px;
  // &-iconmore {
  //   color:#fff;
  //   font-size: 22px;
  // }
  &__icon {
    color:#fff;
    font-size: 20px;
    transform: rotate(90deg);
  }
  &__header {
    height: 42px;
    line-height: 42px;
    padding: 0 15px;
    border-bottom: 1px solid #f6f6f6;
    color: #333;
    border-radius: 2px 2px 0 0;
    font-size: 14px;
    small {
      margin-left: 8px;
      color: #999;
    }
  }
  &__body {
    padding: 10px 15px;
    line-height: 24px;
  }
  &__about {
    font-size: 14px;
    line-height: 30px;
  }
  &__shade {
    position: fixed;
    display: none;
    width: 100%;
    height: 100%;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.3);
    z-index: 2048;
    &--show {
      display: block;
    }
  }
  &__form {
    width: 230px;
    margin: 0 auto;
  }
  &__content {
    box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s;
    position: fixed;
    width: 320px;
    height: 100%;
    right: -450px;
    top: 0;
    z-index: 2048;
    background-color: #fff;
    &--show {
      right: 0;
    }
  }
}
</style>
